var bg = chrome.extension.getBackgroundPage();

var data = {
    status: "尚未就绪",
    decks: null,
    posx: 0,
    posy: 0
};

document.addEventListener("DOMContentLoaded", function () {
    if (bg.KCE.tabId != null) {
        data.status = "已就绪";
        data.decks = bg.KCE.decks;
    }

    var app = new Vue({
        el: "#app",
        data: data,
        methods: {
            clickBtnEvt: function (event) {
                if (isNaN(data.posx) || isNaN(data.posy)) {
                    return;
                }
                bg.sendMessage({
                    type: "click",
                    x: data.posx,
                    y: data.posy
                });
            }
        }
    });
});